//
// Created by sgyt on 2020/1/15.
//getpwuid,getpwnam

#include <stdio.h>
#include <stdlib.h>
#include <pwd.h>
#include <sys/types.h>
int main(int argc,char *argv[])
{
    struct passwd *wd1;
    struct passwd *wd2;
    wd1 = getpwnam("root");
    wd2 = getpwuid(0);
    printf("wd1_name:[%s],wd1_passwd:[%s],wd1_uid:[%d],wd1_gid:[%d]\n",wd1->pw_name,wd1->pw_passwd,wd1->pw_uid,wd1->pw_gid);
    printf("wd1_name:[%s],wd1_passwd:[%s],wd1_uid:[%d],wd1_gid:[%d]\n",wd2->pw_name,wd2->pw_passwd,wd2->pw_uid,wd2->pw_gid);
    return 0;
}
